package com.fieldchain.ex.fa100.custom.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import com.fieldchain.ex.fa100.utils.share.ShareManager;


/**
 * Created by 123 on 2018/5/25.
 */

public abstract class BaseDialog extends Dialog {
    public Window win;
    private boolean isLight=false;

    public BaseDialog(Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(setLayout());
        findView();
        setValue();
        setWindown();
    }

    public abstract int setLayout();

    public abstract void findView();

    public abstract void setValue();

    private void setWindown(){
        win = getWindow();
        win.setBackgroundDrawable(new ColorDrawable());//解决5.0以上阴影问题
        WindowManager.LayoutParams params = win.getAttributes();
        params.width = ShareManager.getInstance().getWidth() * 5 / 6;
        win.setAttributes(params);
    }

}
